<?php
	if(isset($has_error))
	{
		?>
		<ul>
		<?php
		foreach($errors as $error)
		{
			echo "<li style='color:red;font-weight:bold;height:15px;'>$error</li>";
		}
		?>
		</ul>
		<?php
	}
	
	if(isset($message))
	{
		echo "<span style='color:red;font-weight:bold;'>$message</span>";
	}
?>

<form action="<?php echo Utility::getSiteUrl();?>/advertisement/<?php if($action == 'edit') echo "edit/$id"; else echo 'add';?>" method="post">
<fieldset>
<legend>Thông tin quảng cáo</legend>
<table>
	<tr>
		<td>Tên quảng cáo</td>
		<td><input type="text" name="name" value="<?php if(isset($input)) echo ($action=='edit'?$input->name:$input['name']);?>"/></td>
	</tr>
	<tr>
		<td>Mô tả</td>
		<td><textarea name="description" cols="30" rows=""><?php if(isset($input))  echo ($action=='edit'?$input->description:$input['description']);?></textarea></td>
	</tr>
	<tr>
		<td>Đường dẫn ảnh</td>
		<td><input type="text" name="image" value="<?php if(isset($input)) echo ($action=='edit'?$input->image:$input['image']);?>"/></td>
	</tr>
	<tr>
		<td>Liên kết ngoài</td>
		<td><input type="text" name="link" value="<?php if(isset($input)) echo ($action=='edit'?$input->link:$input['link']);?>"/></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" value="Thêm quảng cáo" /><input type="reset" value="Nhập lại"/></td>
	</tr>
</table>
</fieldset>
</form>